package protocol;

import com.google.common.collect.ImmutableMap;
import constants.Configurations;
import utils.SignUtil;

import java.util.Map;

public class SignedRequest {

    public long id;

    public Map<String, String> client;

    public Map<String, Object> data;

    public final String encrypt = "md5";

    public String sign;

    public static SignedRequest of(String caller,String secretKey,Map<String, Object> data) {
        SignedRequest sb = new SignedRequest();
        sb.id = System.currentTimeMillis();
        sb.client = ImmutableMap.of("caller",caller, "ex", "");
        sb.data = data;
        sb.sign = SignUtil.generateSign(data,caller,secretKey);
        return sb;
    }

}
